home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
asmutil
/
a86v400.zip
/
A03.DOC
< prev
next >
Wrap
Text File
|
1994-12-17
|
23KB
|
508 lines
CHAPTER 3 OPERATION AND REQUIREMENTS
Creating Programs to Assemble
Everything I say about A86 applies equally well to my A386
assembler, whose program name is A386. The additional features
of A386 consist of the 32-bit register set and additional
instructions and instruction forms, outlined in Chapter 6. A386
is available only on the registered A86+D86 disk.
Before you invoke A86 you must have an assembly-language source
program to assemble. A source program is an ASCII text file,
created with the text editor of your choice. The editor must
produce a file that is free of internal records known only to the
editor. Some of the fancier word processors will require you to
use a "plain text" mode to insure that the file is free of such
records.
This manual will fully explain to you the correct syntax of an
A86 program, but it is not intended to teach you about the
86-family instruction set, or about assembly-language interfacing
to your computer or your operating system.
The instruction set charts in Chapters 6 and 7 give concise,
one-line descriptions of each instruction, but they don't go into
any detail about instruction usage, or about how to make system
calls to input from keyboard or disk, output to screen, printer
or disk, etc. For that, you need a book that covers the MS-DOS
operating system and the BIOS for the IBM-PC. I am currently
using DOS Programmer's Reference by Terry Dettmann, available by
mail from Public Brand Software at 1-800-426-3475. At a more
instructional level, my users report that Peter Norton's Assembly
Language Guide to the IBM-PC has been helpful.
Program Invocation
To invoke A86, you must provide a program invocation line, either
typed to the console when the DOS command prompt appears, or
included in a batch file. The program invocation line consists
of the program name A86, followed by assembler switches
(described in the next section), and the names of the source
files you want to assemble, and of the output files you want to
produce. If the output files all have their standard extensions,
they may appear in any order: before, after, or even intermixed
with the source file names. If they don't have their standard
extensions, you must give the source file names first, followed
by the word TO, followed by the output file names. Each
non-standard name following the word TO will be assigned to the
first previously- unassigned output file in order: program,
symbols, listing, then cross-reference.
You may use the wild card delimiters * and ? if you wish, to
denote a group of source files to be assembled. A86 will sort
all matching names into alphabetical order for each wild card
specification; so the files will be assembled in the same order
even if they get jumbled up within a directory.
3-2
If you provide a name without a period or an extension, A86 will
use that as the output program file name, appending to it the
default extension as follows:
1. .OBJ if you invoked the +O switch, for linkable object file
production.
2. .BIN if there is no +O switch, but there is an ORG 0 of in
your program, without a later ORG 256.
3. .COM otherwise.
If you want your program file to have no extension, you end the
file name with a period.
You may omit any of the output file names if you wish. If you do
so, A86 will output the program source.COM (or source.OBJ or
source.BIN), where "source" is a name derived from the list of
source files, according to the rules described in the section
"Strategies for Source File Maintenance" later in this chapter.
Any of the other output files will use the name of the program
output file, combined with the standard extension for that output
file.
Assembler Switches
In addition to input and output file names, you may intersperse
assembler switch settings anywhere after the A86 program name.
They are all acted upon immediately, no matter where they are on
the command line. Some of the switches are discussed in more
detail elsewhere; I'll summarize them here:
+C causes the assembler to output symbol names with lower
case letters to its OBJ and SYM files. The case of letters
is still ignored during assembly. I output the name as it
appears in the last PUBLIC or EXTRN directive containing it;
if there is no such directive, I use the first occurrence of
the symbol to control which letters are output lower case.
(+C duplicates Microsoft MASM's /mx switch.)
+c causes the assembler to consider the case of letters
within all non-built-in symbols as significant both during
assembly and for output. Thus, for example, you can define
different symbols X and x. (+c duplicates MASM's /ml
switch.)
+D causes the default base for numeric constants to be
decimal, even if the constants have leading zeroes.
-D causes the default base to be hexadecimal if there is a
leading zero; decimal otherwise.
+E causes the error-message-augmented source file to be
written to yourname.ERR within the current directory, in all
cases. With +E, A86 will never rewrite your original source
file.
3-3
-E causes A86 to insert error messages into your source file,
whenever the file is in the current directory. If the file
is not in the current directory, A86 writes an ERR file no
matter what the E switch setting is.
+F causes A86 to generate the 287 form of floating point
instructions (no implicit FWAIT bytes are generated before
the instructions). This mode can also be specified in the
program with the .287 directive.
+f causes A86 to support emulation of the 8087. When A86
sees a floating point instruction, it generates external
references to be resolved by the standard emulation library
(provided by Microsoft, Borland, etc.). When you LINK your
program to the emulation library, the floating point
instructions are emulated by software. NOTE you must be
assembling to a linkable OBJ file for this mode to have
effect; otherwise, +f is ignored.
-F causes emulation and default-287 to be disabled. You'll
still get 287 generation if there is a .287 directive in your
program.
+G n causes A86 to implement one or more of the
following minor options for code-generation. All these
options enhance MASM compatibility. The first three do so at
the expense of program size. The number n should be the sum
of the numbers for each of the options selected. For
example, +G10 will select the options numbered 2 and 8.
1 causes A86 to generate a longer (3-byte) instruction
form for an unconditional JMP instruction to a forward
reference local label, e.g. JMP >L1. A86 normally
assumes that since it's a local label, it will be nearby
and the short, 2-byte form will work. With this option
your code will usually be longer than necessary, but
you'll be spared having to occasionally go back and code
an explicit JMP LONG >L1.
2 causes A86 to refrain from optimizing the LEA
instruction. Without this option A86 will replace an LEA
with a shorter, equivalent MOV when it sees the chance.
4 causes A86 to generate a slightly more inefficient
internal format for memory references within an OBJ file.
The Power C compiler's MIX utility requires the
inefficient form. The makers of Power C refused to
support their customers on this by enhancing MIX, so I am
forced to offer this option.
8 causes A86 to assume that all ambiguous forward
reference operands to instructions other than jumps or
calls refer to memory variables and not offsets or
constant values. You can override this on a one-by-one
basis, with the OFFSET operator.